fix(agc): detect AMD proprietary narrow clock #1632
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1632"
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 MarcZX10 on 2026-10-08T15:19:57Z.
Closes #1615.
What
Pass the Vulkan physical-device ID into
NarrowSubgroupClock. On AMD's proprietary Vulkan driver, select the device clock only for devices with measured 20-bit subgroup clocks:0x1114— Radeon 860M, measured in #1615.0x744c— Radeon RX 7900 XT, measured in the report on this PR.0x747e— Radeon RX 7800 XT, measured in the report on this PR.Other device IDs and driver IDs keep their existing behavior. Tests cover all three measured devices, adjacent unmatched IDs, and other driver IDs. TechnicalDebt records the measurements and the limits of what they establish.
Tested
Current head is
02005c86d27d7ffa36ce7a9c426e2e4510166b94, based on upstreammainatfff9bd31852ae605ede355ad230a50321b4b4ec9.libSceAgcDriverandagc_subgroup_clock_tests; focused CTestagc_subgroup_clockpasses (1/1).python3 tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpass locally.0x747e), AMD driver32.0.31041.1004, WinLibs GCC 15.2.0 r7, Release: a contributor tested this exact head without local changes. The log reportsnarrowSubgroupClock=1;agc_driver_shader_clockpassed 100/100 andagc_subgroup_clockpassed. Full CTest reported 536 passed, 2 failed, 1 skipped (539 total):agc_driver_vopc_compare_table(#825),patched_libraries(the existing Windows VideoOut duplicate-export issue #2462), andguest_video_out_wqhd_detection_no_vulkanskipped. The Windows run usedninja -k 0after the unrelated patching failure. See the exact-head RX 7800 XT report. No title tested.0x1114) and RX 7900 XT (0x744c) are from previous heads and remain linked below; they are not current-head retests.0x744cand0x747eadditions, so those extensions still need maintainer review.Evidence for
0x744cOn Windows 11 with an RX 7900 XT and AMD driver
32.0.31041.1004, the unmodified detector reproduced the clock wrap. The contributor's extension to0x744cfixed the regression; an adjacent device ID and non-proprietary driver cases retained the existing behavior. Their report and test results are in the hardware report and the exact-head retest. No title testing was reported.Evidence for
0x747eA contributor tested the Radeon RX 7800 XT (
0x747e, RDNA 3) on Windows 11 with AMD driver32.0.31041.1004. On the reportedmainhead5694d3fd,agc_driver_shader_clockfailed 8/8 runs withnarrowSubgroupClock=0; on earlier PR heade7f2e31e, it failed 47/50. Adding0x747emade the detector lognarrowSubgroupClock=1and the test pass 100/100. An adjacent0x747fnegative case was added andagc_subgroup_clockpassed. A subsequent run on current exact head02005c86passedagc_driver_shader_clock100/100 andagc_subgroup_clock; the contributor's full CTest result and unrelated failures are summarized in Tested above. See the initial hardware report and exact-head RX 7800 XT report. No title was tested.Checklist
main; no other open PR implements the same detector changeImported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T15:33:28Z.
Review: APPROVED
LGTM. Targeted fix that correctly identifies the AMD proprietary driver's 20-bit subgroup clock issue on device 0x1114 (Radeon 860M) while leaving other devices unchanged until measured. The test coverage is good - adding cases for the reported device, a neighboring device ID to verify specificity, and confirming other drivers aren't affected. Good update to TechnicalDebt documenting the measured behavior and remaining uncertainty about other AMD proprietary devices.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T19:46:32Z.
Thanks for the review and approval!
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T21:22:02Z.
Rebased the approved change onto current upstream
main(364a56b; head258c85af). The complete five-file diff remains limited to device-ID-specific subgroup clock detection, its tests, and TechnicalDebt. Conventions andgit diff --checkpass; the focused test source compiles and passes directly on this head. The prior CTest run passed (1/1). No checks are reported for this head yet, and no local AMD hardware test is claimed.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T21:24:37Z.
The Build/Conventions workflow runs for current head
258c85af684ff649a80819ca15dcf641f4b88adcare markedaction_requiredand have no jobs, so upstream CI has not run yet. CONTRIBUTING requires maintainer approval for fork workflows. Could an authorized maintainer approve these current-head runs?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T21:43:55Z.
The latest main merge (#533) touched TechnicalDebt.md; I rebased this PR again onto
94b1eecband checked that both the shader min/max notes from main and the Radeon 860M note remain. Current head is85959bc8. Conventions,git diff --check, and the directly compiled focused test pass on this head. Its Build/Conventions/Progress runs are againaction_required; could a maintainer approve the current workflows?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T00:24:50Z.
Rebased onto current upstream
main(f145139676a48306681d3a4d5fabf83938759daf) at head73f30f1226ace788838ac6f404be755404a16234. Reviewed the complete five-file diff; the device-ID-specific change and TechnicalDebt evidence remain intact. The focusedagc_subgroup_clocktest passes (1/1),libSceAgcDriverbuilds, and conventions plusgit diff --checkpass. Upstream checks need to run on this rebased head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T00:25:23Z.
Rebased head
73f30f1226ace788838ac6f404be755404a16234is on current upstreammain(f145139676a48306681d3a4d5fabf83938759daf). The focused CTest and full library build pass locally. No checks are reported for this fork head. Under CONTRIBUTING's workflow policy, could an authorized maintainer approve Build and Conventions?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T00:44:58Z.
The fork Build for current head
73f30f1226ace788838ac6f404be755404a16234completed successfully: Linux, Windows, and relinker jobs on Ubuntu, Windows, and macOS passed. I added the run link to the PR description. Upstream still reports no checks for this fork head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T08:29:51Z.
Found and fixed the prior Conventions failure: the PR body did not fill the required Depends on field. The updated body states
none, and the source conventions check passes locally. Rebased the reviewed five-file diff onto currentmain6cc0503d, pushed head88c546cd, and reran the focusedagc_subgroup_clockCTest (1/1 pass). Fork Build 37905279099 is running. Could an authorized maintainer approve the exact-head upstream Conventions run if GitHub marks itaction_requiredunder the fork workflow policy?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T08:39:00Z.
Latest fork Build completed with the same baseline failure on Linux and Windows:
agc_shader_fusion_testscannot includespirv/unified1/spirv.hppfromVulkanTestDevice.hpp. The relinker jobs passed. This matches #2093; I recorded the exact result in the PR description and kept this PR's scope separate.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T09:23:13Z.
Updated to current upstream
maind9484c71(head378c25b3). The complete five-file diff is unchanged in scope; the focused subgroup-clock test was compiled and run on this head, local Conventions pass, and the exact-head upstream Conventions check is green. The earlier full Build on a prior head passed; a collaborator-triggered full Build is still required under #2113, and the previous approval is attached to the old head. Could an upstream collaborator run the Build workflow for PR #1632 and re-review this updated head?Imported from boykopovar/AnyPS5. Originally posted by joelfernandes23 on 2026-10-09T13:02:13Z.
I reproduced #1615's clock wrap on an RX 7900 XT and tested a small extension to this PR for measured device ID 0x744c.
Environment: Windows 11 Pro 10.0.26200, Ryzen 7 7700X, 32 GB DDR5, RX 7900 XT, AMD driver 32.0.31041.1004, Vulkan 1.4.349. WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7, Release, BUILD_TESTING=ON, SPIRV-Tools OFF. ANYPS5_GPU=7900 XT and ANYPS5_REQUIRE_VULKAN=1.
On unchanged main
d70b89989473ba1f6ae13e44e079e67f1f8a44b0:Applied your PR head
f4fec653e98954de46d6fc484d676a4a6fe2a2aato that main and added 0x744c alongside 0x1114 in the proprietary-driver check. The local extension patch changes only the detector, its existing tests and TechnicalDebt. Your prerequisite commit's authorship is preserved locally.agc_driver_shader_clockpassed 100/100 consecutive runs with the extension (128 dispatches per run). The verbose run confirmsnarrowSubgroupClock=1on the RX 7900 XT.agc_driver_vopc_compare_table/ #825. The skip isguest_video_out_wqhd_detection_no_vulkan.The device-clock timing approximation is recorded in TechnicalDebt. No title testing or other 0x744c boards tested.
I can share the extension patch if useful.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T13:17:19Z.
Thanks for the RX 7900 XT measurement and test report. I incorporated device ID
0x744cinto #1632, added a positive case plus an adjacent unmatched-ID case, and updated TechnicalDebt with the evidence. The updated head is504ac892; the focusedagc_subgroup_clocktest passes 1/1. Your full CTest result and the unrelated #825 failure are recorded in the PR description.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T13:18:28Z.
Rebased #1632 onto current upstream main
d70b8998after the RX 7900 XT update. The new exact head is a230723716e35d768b8a72b4261183d9016135e6. The focused agc_subgroup_clock CTest passes 1/1, Conventions and diff checks pass, and the PR now records the measured 0x744c behavior and the reported full-suite result (including its unrelated #825 failure). Under CONTRIBUTING, could an authorized collaborator run Actions → Build for this current head? The previous request was for the pre-rebase head.Imported from boykopovar/AnyPS5. Originally posted by joelfernandes23 on 2026-10-09T13:41:26Z.
Retested exact updated head
a230723716e35d768b8a72b4261183d9016135e6on the same Windows 11 / RX 7900 XT / driver 32.0.31041.1004 setup, Release, WinLibs GCC 15.2.0, BUILD_TESTING=ON, SPIRV-Tools OFF, ANYPS5_GPU=7900 XT and ANYPS5_REQUIRE_VULKAN=1.agc_subgroup_clock: 100/100 consecutive runs passed.agc_driver_shader_clock: 100/100 consecutive runs passed (128 dispatches per run).0x744c, driver1,narrowSubgroupClock=1.agc_driver_vopc_compare_table/ #825: wave32 lane 29cmp_lg_f32_e32is 1, expected 0. The skip isguest_video_out_wqhd_detection_no_vulkan.git diff --check origin/main...HEADpassed. Working tree clean.No title testing. These results are for the updated PR itself, without local code modifications.
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-09T15:44:41Z.
Hardware side of the
s_memtimequestion, measured on RDNA2 (gfx1036, Ryzen 7950X3D iGPU) withtools/hw-oracleon Linux (CachyOS, kernel 7.2.9, hsa-rocr 7.2.4, clang 23.1.1 as the assembler, tools atmaind70b8998), in case it helps the entry this PR rewrites. One wave32 readss_memtime,s_memrealtimeands_getreg_b32 hwreg(HW_REG_SHADER_CYCLES)before and after a counted loop of twov_add_f32and the loop control; all reads uniform over the wave.s_memtimedeltas_memrealtimedeltaSo on this GPU
s_memtimecounts shader cycles in more than 20 bits (the delta 9,200,022 did not wrap; 23 cycles per iteration throughout; the high dword of the ISA's 64-bit value stayed 0 in these reads),SHADER_CYCLESadvances in step with it from a different base (its 20-bit delta equals thes_memtimedelta mod 2^20: 811,414 = 9,200,022 mod 2^20; at the first read it stood at 1,924 to 1,984 against 44,147 to 113,861 fors_memtime), and, takings_memrealtimeas the 100 MHz reference clock the entry names, the ratio gives a shader clock of 0.6 GHz in the shortest run and 2.1 GHz in the longest. As_memtimethat returns the 100 MHz device clock therefore runs 6 to 21 times slow against this GPU's counter, and a 20-bit cycle counter wraps every 2^20 cycles, 0.49 ms at 2.1 GHz. Bodies and outputs: https://github.com/SleglJan/AnyPS5/tree/audit/oracle-2026-10-08/oracle-audit/scalar-misc (clock-*).AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by danielradosa on 2026-10-09T17:30:05Z.
A data point for an unmeasured device on AMD's Windows driver: the RDNA 2 iGPU of a Ryzen 5 7600 (gfx1036, device
0x164e), driver 32.0.21045.5002, does not wrap.Windows 11 Pro 10.0.26300, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON,ANYPS5_GPU="Radeon(TM) Graphics",ANYPS5_REQUIRE_VULKAN=1. Tree:main0fdda7beplus #1748, which only touches libkernel, so the detector ismain's.agc_driver_shader_clockpassed 600/600 consecutive runs (128 dispatches each) on the subgroup clock. On the 860M in #1615 the same test failed 49 of 160. So on this driver the subgroup clock of0x164eis not 20 bits, and leaving it out of the list is right for this device. The RADV wrap reported on #1615 for the Ryzen 5 7600X iGPU (also gfx1036) does not show through AMD's Windows driver here, which fits SleglJan's hw-oracle reads above:s_memtimeon gfx1036 is wider than 20 bits.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:34:53Z.
Thanks for the Windows 0x164e data point and the 600/600 run record. I added it to the PR description as a boundary measurement: it supports leaving that device unmatched, without generalizing the result to all gfx1036 hardware or AMD proprietary drivers. No detector change is needed for this device.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:46:06Z.
Rebased this PR onto current
mainat headdf3efcae. The changed sources build intolibSceAgcDriver, andagc_subgroup_clockpasses 1/1; Conventions and diff checks pass. The recorded Windows hardware runs predate this rebase, so current-head Windows and the required upstream Build matrix are still outstanding.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T18:04:27Z.
The PR description now reflects current head
df3efcaeonmainf8c2f072and separates the current Linux checks from the pre-rebase Windows hardware evidence. It also records that the existing approval predates the0x744caddition.The RX 7900 XT measurement is documented in the linked report, with positive and adjacent-ID negative coverage in the current diff. Could a maintainer review the added
0x744ccase and run the required Linux/Windows Build and relinker matrix against this exact head before merge?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T19:18:59Z.
Rebased the existing PR linearly onto current
main(ae3d5f95) at headd8f4f207. The complete diff remains five files. On this head, the productionlibSceAgcDriverandagc_subgroup_clock_testsbuild on Linux, andagc_subgroup_clockpasses (1/1). Local and GitHub Conventions pass. The RX 7900 XT hardware report remains explicitly labeled as pre-rebase evidence, and the earlier approval predates this device-ID addition.\n\nCould a maintainer review the0x744ccase and a collaborator with write access run the required upstream Linux/Windows Build and relinker matrix on this exact head under #2113?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T19:48:55Z.
Updated head and evidence
I rebased the existing branch linearly onto upstream
mainat8b393b6eand pushed heade7f2e31e. The full five-file diff is unchanged in scope. On the rebased source, LinuxlibSceAgcDriverandagc_subgroup_clock_testsbuild, and the focused CTest passes (1/1); Conventions andgit diff --checkpass. The Windows hardware runs remain explicitly labeled as pre-rebase evidence, and the0x164enegative coverage plus RDNA2s_memtimemeasurements are recorded in the description.The existing approval predates the measured
0x744cextension. Could a maintainer review that addition and, if acceptable, run Actions → Build for PR #1632 on this current head? The full upstream Linux/Windows and relinker matrix has not run for it.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-09T21:42:18Z.
Tested on the device this PR names first, the Radeon 860M (RDNA 3.5,
0x1114), at the current head. Windows 11 (26300), AMD driver 32.0.13058.8001, WinLibs GCC 15.2.0 r7, Release,agc_driver_shader_clockrun 100 times in a row:agc_driver_shader_clockmain00159cffShader clock driver=1 narrowSubgroupClock=0memtime: lane 0 went back from 1045940 to 16475e7f2e31eShader clock driver=1 narrowSubgroupClock=1agc_subgroup_clockpasses on both.Imported from boykopovar/AnyPS5. Originally posted by PYTHONRETARDE on 2026-10-09T21:49:20Z.
RX 7800 XT (device
0x747e, RDNA 3) wraps the same way and isn't covered by the current device list.Windows 11 Pro 10.0.26200, AMD driver 32.0.31041.1004, Vulkan 1.4.349, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7, Release, BUILD_TESTING=ON.
narrowSubgroupClockagc_driver_shader_clockmain5694d3fde7f2e31ememtime: lane 0 went back from 1029437 to 33290x747eEvery failure has the first read just under 2^20 (1,029,437 to 1,047,608) and the second small; the step back plus the wrap is about 22,300 cycles in every run.
The change tested, on top of
e7f2e31e:plus
{VK_DRIVER_ID_AMD_PROPRIETARY, 0x747e, "AMD Radeon RX 7800 XT", true}and an adjacent0x747f→falsecase intests/SubgroupClock.cpp;agc_subgroup_clockpasses. Full CTest with it: 509 passed, 1 failed, 1 skipped (511). The failure isagc_driver_vopc_compare_table/ #825; the skip isguest_video_out_wqhd_detection_no_vulkan.With 0x1114, 0x744c and now 0x747e (RDNA 3.5 and two RDNA 3 boards on the same driver) all wrapping, matching device IDs one at a time may not scale; #1615's option 2 (a GFX11 device-ID range) might be worth reconsidering. No title tested.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T21:52:31Z.
I updated the Tested section with Leandro's Radeon 860M report on the exact previous head: the main baseline failed 32/100 shader-clock runs, while this PR passed 100/100 and selected the narrow subgroup clock. The report is identified as pre-rebase evidence.
GitHub marked the PR conflicting after
mainadvanced, so I rebased the existing branch onto292d854eand preserved the newer RADV TechnicalDebt text together with the measured0x1114and0x744centries. Current head isafae311c; Linux driver/test build,agc_subgroup_clock(1/1), Conventions, andgit diff --checkpass. The PR is mergeable again.The 100-run hardware report is still from the prior head, and the official upstream Build/relinker matrix plus maintainer review of the
0x744caddition remain outstanding.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T22:05:31Z.
Thanks for the RX 7800 XT measurements. I updated the existing PR with the measured
0x747eID, an adjacent0x747fnegative case, and the TechnicalDebt evidence. The branch is rebased onfff9bd31at02005c86;libSceAgcDriverandagc_subgroup_clock_testsbuild, the focused CTest passes (1/1), and local conventions/diff checks pass. The 100/100 hardware result is recorded as the contributor’s test atop prior heade7f2e31e, not as a run of current head. I kept the selection to measured IDs rather than extending it to an unmeasured GFX11 range.Imported from boykopovar/AnyPS5. Originally posted by PYTHONRETARDE on 2026-10-09T22:25:47Z.
Retested exact head
02005c86on the RX 7800 XT (0x747e), same setup as above (Windows 11 Pro 10.0.26200, AMD driver 32.0.31041.1004, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON), no local changes.device=0x747e,Shader clock driver=1 narrowSubgroupClock=1.agc_driver_shader_clock: 100 of 100 passed.agc_subgroup_clock: passes.agc_driver_vopc_compare_tableis #825.patched_librariesfails becauselibSceVideoOut.prxdoes not patch on Windows at this base (duplicate patched export name: LibwuIonIBw, #2462, frommain, not this PR); the build was run withninja -k 0to get past it. The skip isguest_video_out_wqhd_detection_no_vulkan.No title tested.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T22:35:51Z.
Follow-up on the
patched_librariesfailureThanks for the exact-head RX 7800 XT rerun. The 100/100
agc_driver_shader_clockresult on0x747econfirms the current subgroup-clock change.The Windows
patched_librariesfailure is the separate VideoOut duplicate-export issue #2462. Celegans12 opened #2473 with the two-line alias removal. Its Build eligibility, Conventions, intake, and report checks are still queued; they have not validated that PR yet.I independently built
libSceVideoOutandnid_patcheron Linux/GCC 12.2 Release, and the patched ELF contains each NID once. This does not exercise the Windows PE patcher. Once #2473's Windows Build runs, rerunpatched_librariesto confirm the Windows failure is gone. Theagc_driver_vopc_compare_tablefailure remains tracked separately as #825.AI-assisted: yes.