test(agc): make a missed order-hold wake slow in agc_driver_pm4_order_signal #24170
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24170"
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?
Imported from boykopovar/AnyPS5. Originally posted by GiannisG1 on 2026-11-20T08:55:55Z.
What
agc_driver_pm4_order_signal(#22188) fails onmain's Linux job. It checks that a wait-free submission held behind queue 0 starts within 0.1 ms (median) of queue 0 blocking on the label it writes, and loaded runners land around 0.14 ms. On #22188, oneandonlydean asked for a test in which a missed wake is slow instead of a small gap (comment), and I took the first variant (comment).QueueWorker.cpp: the held submission'schanged.wait_forwaitsOrderHoldWait()instead of a fixed 200 µs.SubmissionRing.cpp:OrderHoldWait()reads a test-onlyAPS5_ORDER_HOLD_WAIT_US, from 1 to 1000000. It defaults to 200, so nothing changes unless the variable is set. It is read with the other queue settings at the first submission (ReadSubmissionRingSettings), so an invalid or zero value rejects the submission, asAPS5_PM4_RINGandAPS5_STALL_WATCHDOG_SECSdo.docs/dev/ENVIRONMENT.mdlists it.agc_driver_pm4_order_signal, which checks first that the value is at least that and then compares the median with 5 ms. Two new cases,agc_driver_pm4_order_hold_wait_invalid(50x) andagc_driver_pm4_order_hold_wait_zero(0), useexpectSettingRejectedlike the ring and watchdog cases.What the test now catches, and what it cannot. If nothing wakes the hold when queue 0 blocks, the median is about 25 ms and the test fails. With either the old bound or the new one, it cannot tell whether the
orderHoldersnotify that #22188 added at the end ofDriver::noteWaitBlockedis present. In this test queue 0's block leaves no worker running, so the idle-epoch notify a few lines earlier (runningWorkersreaching 0) wakes the hold too. It fires just beforequeue0Awaitedis stored, and the woken hold nearly always reads the value after the store. Removing only theorderHoldersnotify left the median at 0.07 ms (table below). Only the rare lost race fell back to the fallback wait, which is where 10 to 25 ms largest samples came from.To see that notify alone, another worker has to be running when queue 0 blocks. I tried a third queue (0x21) running 16384 writes behind an already-satisfied
WAIT_REG_MEM, which made it not wait-free, so nothing held it or was held behind it. It did not overlap the block in any of 32 rounds: write streams on two queues ran one after the other (APS5_TRACE_GPU: queue 0's 4096 writes reached its wait at 132 ms, after queue 0x21 finished at 107 ms). That attempt is not in this PR. A running GPU dispatch on another queue might do it; that would be a follow-up if you want it.#23886 (cocoa55) has since landed: on
mainanAPS5_SKIP_TIMING_TESTSreturn before thischeckskips the latency bound in the sanitizer job. This head is rebased onto it and keeps that return, so the 5 ms bound applies wherever timing tests run.Tested
Linux Mint 22.3, kernel 7.0.0-38, GCC 13.3.0, Release,
BUILD_TESTING=ON. Head onmain4cb7752e50, rebased over #23886; the only conflict was thatcheckline. The table and the load runs below were measured on the previous head onmain79d02ad925. The order-signal test creates no Vulkan device (the split suite runs it once), so the device setting does not matter for it. It ran withANYPS5_GPUset to each of the three devices below.orderHoldersnotifies removed fromnoteWaitBlocked(nothing wakes the hold)orderHoldersnotify removedmain79d02ad925agc_driver_pm4_order_signalpasses 12/12, 3 runs with each of the GTX 1050 Ti, HD 630, llvmpipe and lavapipe 26.0.8 settings (median 0.051-0.060 ms), and once each with the validation layer (no VUIDs).agc_driver_pm4_order_hold_wait_invalidand_zeropass. As a control, the invalid mode run with a valid value (APS5_ORDER_HOLD_WAIT_US=500) fails withexpected PM4 rejection.main41dfbe4d8eon the same machine (every test once on the GTX 1050 Ti, the 2091 GPU tests on all three devices). GTX: no failure. HD 630: the 10 known on this machine and 4 more. llvmpipe:image_filter_mode_three(#27671),scattered_runs(#21649) and 2 more. The 6 extra failures areimage_d16_load(HD 630, llvmpipe),image_plane_offset_on_lineandimage_sample_cube_offset(HD 630), andimage_sample_lod_clamp_shader_lane(HD 630, llvmpipe). The first three are tests that landed onmainsince (#22750, #23701, #23498). With this PR's changes left out,main4cb7752e50fails all 6 the same way, 3/3 on each device. The two new tests pass on all three.check_conventions.py,check_test_registration.py,check_main_sync.py(1 ahead, 0 behind, merges cleanly),check_compile.py(3 translation units),tools/env_reference.py --check(751 names, all documented) andgit diff --checkare clean.tools/pr_overlap.py --branchcompared 174 PRs and reports one: #22029 atPm4.cppL3049, the one-line mode table that the two new cases extend. Of the 25 it could not compare (they conflict withmain), #6186, #11436 and #12944 touch the same files but not these lines (#12944 changes the test mode list a few lines away inagc_driver_graphics_tests.cmake); the others share onlyENVIRONMENT.mdor that cmake file.poll(unchanged here).Checklist
main; no other open PR implements the same functionsNotImplemented_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)🤖 Generated with Claude Code
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:24:44Z.
Review: COMMENTED
Reviewed — comments
The new configurable fallback wait and test cases are documented and wired into submission settings; the timing test’s stated limit is not demonstrated by this change.
What I ran
Read the prepared diff and all six changed files at head
4de3318c33e18f081fc3d48fed850c0df899e004, including every added line. ReadSubmission.cpparound the callers ofReadSubmissionRingSettings. No tests or build checks were run.Results
Findings
Blocking
None.
Non-blocking
orderHoldersnotification still passes 9/9 runs, with a median as high as 1.536 ms, under the 5 ms threshold. This makes the test tolerant of the specific missed-wake defect it aims to detect. Consider tightening or restructuring the test so this regression fails reliably. Changed line:core/libs/prx/libSceAgcDriver/tests/Pm4.cpp:2667.Not verified
No build, tests, or static checks were run. The author’s reported test results were not independently verified. Read all changed files listed in the manifest; no changed files were excluded.
To get this to a good state
Nothing is required. The optional test reliability point is listed above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T09:08:46Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
c5564d012d500c16114be5972b01cb8ffb7fcaed. No commands or tests were run; this review used the prepared diff and pinned repository reader.Results
Findings
Blocking
None.
Non-blocking
orderHoldersnotification: the idle-epoch notification can also wake the hold. That limitation is documented clearly, but the test's name and failure text may still suggest it verifies the specific wake introduced in #22188. Consider clarifying the test description or name that it checks prompt wake behavior through the available notifications, while retaining the stated follow-up for a test that isolatesorderHolders.Not verified
No tests, builds, or platform-specific behavior were run. Author-reported Linux test and check results were not independently verified; Windows behavior was not run. The prepared review folder contained all changed files; all six changed files listed in the manifest were read, including each added line. The diff excluded no changed files according to the manifest.
To get this to a good state
Nothing is required. The test-isolation clarification is optional.